<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组排序</title>
</head>
<body>
    <script>
        var input;
        var arr=[];
        while(input!='-1'){
            input=Number(prompt('请输入您想要排序的数字'));
            arr.push(input);
        }
        arr.pop();
        arr.sort(function(x,y){return y-x;});
        alert(arr);

    </script>
</body>
</html>